package kr.co.goodwilldd.controller.common;

import kr.co.goodwilldd.service.board.IBoardService;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * Handles requests for the application home page.
 */
@Controller
public class HomeController {

	private static final Logger logger = LoggerFactory
			.getLogger(HomeController.class);

	@Autowired
	IBoardService boardService;

	@RequestMapping(value = "home", method = RequestMethod.GET)
	public String home(Model model) {
		return "home";
	}

	@RequestMapping(method = RequestMethod.GET)
	public String common(Model model) {
		return "redirect:/home";
	}

	@RequestMapping(value = "product/main", method = RequestMethod.GET)
	public String productMain(Model model) {
		model.addAttribute("boardList", boardService.getNoticeList(1));
		return "product/main";
	}

	@RequestMapping(value = "community/main", method = RequestMethod.GET)
	public String communityMain(Model model) {
		return "community/main";
	}
}
